package demo509;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileAlreadyExistsException;

public class Test {
    public static void main(String[] args) throws IOException {
String data = "                                今天是周五五五五五五" +
        "叽叽叽叽叽叽叽叽" +
        "太美" ;
        FileOutputStream fileOutputStream = new FileOutputStream("1.txt");
        byte[] bytes = data.getBytes();
        fileOutputStream.write(bytes);

        FileInputStream fis = new FileInputStream("1.txt");
        byte[] buffer = new byte[1024];
        int bytesRead;
        StringBuilder content = new StringBuilder();
        while ((bytesRead = fis.read(buffer))!=-1){
            content.append(new String(buffer,0,bytesRead));
        }
System.out.println("文件内容："+content.toString());


    }
}
